package cl.minvu.catastro.util;

import org.apache.commons.codec.binary.Base64;

/**
 * @author psep
 *
 */
public final class SecurityUtil {
	
	/**
	 * @param plainText
	 * @return
	 */
	public static final String encode(String plainText) {
		String encryptText = null;
		byte[] bytesEncode = Base64.encodeBase64(plainText.getBytes());
		encryptText = new String(bytesEncode);
		
		return encryptText;
	}
	
	/**
	 * @param encryptText
	 * @return
	 */
	public static final String decode(String encryptText) {
		String plainText = null;
		byte[] bytesEncode = encryptText.getBytes();
		byte[] bytesDecode = Base64.decodeBase64(bytesEncode);
		plainText = new String(bytesDecode);
		
		return plainText;
	}

}
